import http from '@/utils/request.js';
import { removeEmpty } from '@/utils/utils.js';

// 获取任务列表
// export const getIndex = (data) => {
// 	return http.get('/repair/maintain/plan/content/page',data)
// }

// 获取是否存在任务中工单
export const getWorking = (data) => {
	// return http.get('/repair/maintain/plan/content/planTypeStatistic',data);
	return http.request({
		url: '/repair/maintain/plan/content/planTypeStatistic',
		method: 'get',
		data,
	});
};

// 获取任务列表(按日期分组)
export const getDateList = (data) => {
	// return http.post('/repair/maintain/plan/content/list',removeEmpty(data),true);
	return http.request({
		url: '/repair/maintain/plan/content/list',
		method: 'post',
		data: removeEmpty(data),
		textJson: true,
	});
};

// 获取任务列表（离线，旧列表）
export const getDateListOffLine = (data) => {
	// return http.get('/repair/maintain/plan/content/old/offline/by/plan/list',removeEmpty(data),true,500000);
	return http.request({
		url: '/repair/maintain/plan/content/old/offline/by/plan/list',
		method: 'get',
		data: removeEmpty(data),
		toast: true,
		timeout: 500000
	});
};
// 延期保养获取小模板
export const getContent = (data) => {
	// return http.get('/repair/maintain/plan/content/getLocationType', data);
	return http.request({
		url: '/repair/maintain/plan/content/getLocationType',
		method: 'get',
		data,
	});
};
// 首页 签到
export const signinPage = (data) => {
	// return http.post('/repair/maintain/sign/in', data, 1);
	return http.request({
		url: '/repair/maintain/sign/in',
		method: 'post',
		data,
		textJson: 1,
	});
};
// ---------------------------------
// 下面是新首页的接口
// 考勤统计
export const userSigin = (data) => {
	// return http.get('/repair/home/user/sign', data);
	return http.request({
		url: '/repair/home/user/sign',
		method: 'get',
		data,
	});
};
// 维修相关
export const reparirData = (data) => {
	// return http.get('/repair/home/user/plan/status', data);
	return http.request({
		url: '/repair/home/user/plan/status',
		method: 'get',
		data,
	});
};
// 我的申请
export const approve = (data) => {
	// return http.get('/repair/home/user/plan/approve', data);
	return http.request({
		url: '/repair/home/user/plan/approve',
		method: 'get',
		data,
	});
};

// 我的审批
export const apply = (data) => {
	// return http.get('/repair/home/user/plan/apply', data);
	return http.request({
		url: '/repair/home/user/plan/apply',
		method: 'get',
		data,
	});
};
// 组长统计
export const plan = (data) => {
	// return http.get('/repair/home/dept/building/plan', data);
	return http.request({
		url: '/repair/home/dept/building/plan',
		method: 'get',
		data,
	});
};
// 维保员统计
export const maintenancePlan = (data) => {
	// return http.get('/repair/home/user/building/plan', data);
	return http.request({
		url: '/repair/home/user/building/plan',
		method: 'get',
		data,
	});
};
// -----------------通讯录接口----------------
export const addressLsit = (data) => {
	// return http.get('/repair/home/dept/address/list', data);
	return http.request({
		url: '/repair/home/dept/address/list',
		method: 'get',
		data,
	});
};
export const userAddress = (data) => {
	// return http.get('/repair/home/user/address/list', data);
	return http.request({
		url: '/repair/home/user/address/list',
		method: 'get',
		data,
	});
};

// 获取进行中的救援任务列表
export const getRescueOrders = (data) => {
	// return http.get('/repair/maintain/malfunction/rescue/home/list', data);
	return http.request({
		url: '/repair/maintain/malfunction/rescue/home/list',
		method: 'get',
		data,
	});
};

// ----------------------------------------优化首页代码接口2024.11.7-----------------------------
// 获取统计角标
export const statistics = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/order/home/type/statistics', removeEmpty(data), true);
	return http.request({
		url: '/repair/maintain/plan/content/plan/order/home/type/statistics',
		method: 'post',
		data:removeEmpty(data),
		textJson: true,
	});
};
// 首页分页接口
export const getList = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/order/home/page/v4',removeEmpty(data),true);
	return http.request({
		url: '/repair/maintain/plan/content/plan/order/home/page/v4',
		data: removeEmpty(data),
		method: 'post',
		textJson: true,
	});
};
// 已完成接口
export const getFinshList = (data) => {
	// return http.post('/repair/maintain/plan/content/plan/order/home/finish/list/v4', data, true);
	return http.request({
		url: '/repair/maintain/plan/content/plan/order/home/finish/list/v4',
		data,
		method: 'post',
		textJson: true,
	});
};

// 延期保养获取小模板
export const getOverdueCount = (data) => {
	// return http.get('/repair/maintain/plan/content/getLocationType', data);
	return http.request({
		url: '/repair/maintain/plan/content/user/overdue/count',
		method: 'get',
		data,
	});
};